// 点位管理
import request from '@/utils/request'

// 区域列表
export const getPageApi = (pageIndex) => request({
  url: '/vm-service/region/search?pageIndex=1&pageSize=10',
  pageIndex
})

// 点位列表
export const getPontionApi = () => request({
  url: '/vm-service/node/search?pageIndex=1&pageSize=10',
  method: 'GET'
})

// 合作商列表
export const getBusinessDistrictApi = () => request({
  url: '/user-service/partner/search?pageIndex=1&pageSize=10',
  method: 'GET'
})

// 添加区域
export const addPointApi = (data) => request({
  url: '/vm-service/region',
  method: 'POST',
  data
})

// 新增点位
export const addPontionApi = (data) => request({
  url: '/vm-service/node',
  method: 'POST',
  data
})

// 新增合作商
export const addPartnerApi = (data) => request({
  url: '/user-service/partner',
  method: 'POST',
  data
})

// 修改区域
export const updataPointApi = (id, data) => request({
  url: `/vm-service/region/${id}`,
  method: 'PUT',
  data
})

// 修改点位
export const updataPontionApi = (id) => request({
  url: `/vm-service/node/${id}`,
  method: 'PUT'
})

// 删除区域
export const deletePointApi = (id) => request({
  url: `/vm-service/region/${id}`,
  method: 'DELETE'
})

// 删除点位
export const deletePotionApi = (id) => request({
  url: `/vm-service/node/${id}`,
  method: 'DELETE'
})

// 删除合作商
export const deletePartnerApi = (id) => request({
  url: `/user-service/partner/${id}`,
  method: 'DELETE'
})

// 点位详情
export const positionApi = (id) => request({
  url: `/vm-service/node/vmList/${id}`,
  method: 'GET'
})

// 商圈列表
export const BusinessDistrictApi = () => request({
  url: '/vm-service/businessType',
  method: 'Get'
})

// 区域详情
export const detailsPointApi = (regionId) => request({
  url: `/vm-service/region/${regionId}`,
  method: 'GET'
})
/**
 * 合作商搜索
 * @param {object} params
 * @returns Promise
 */
export const getPartnerSearchAPI = params => request({
  url: '/user-service/partner/search',
  params
})
